package de.karlNet.mouseMover;

import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.PointerInfo;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class MouseMover extends JFrame {
	private static final Color SECOND_COLOR = Color.RED;
	private static final Color FIRST_COLOR = Color.lightGray;
	private static final int BOX_SIZE_Y = 60/2;
	private static final int BOX_SIZE_X = 75/2;

	public MouseMover() {
		setAlwaysOnTop(true);
		setBackground(FIRST_COLOR);
		setUndecorated(true);
		this.setVisible(true);
		Toolkit toolkit = Toolkit.getDefaultToolkit();

		// Get size
		Dimension dimension = toolkit.getScreenSize();
		PointerInfo a = MouseInfo.getPointerInfo();
		Point point = a.getLocation();
		point.x -= BOX_SIZE_X / 2;
		point.y -= BOX_SIZE_Y / 2;
		this.setLocation(point);
		this.setSize(BOX_SIZE_X, BOX_SIZE_Y);
		try {
			for (int i = 0; i < 3; i++) {
				Thread.sleep(200);
				setBackground(SECOND_COLOR);
				Thread.sleep(200);
				setBackground(FIRST_COLOR);
			}
		} catch (InterruptedException e) {
		}
		System.exit(0);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new MouseMover().show();
	}

}
